<template>
  <div class="view-fill">
    <div v-if="!modifyInfo.visible" class="app-container-flex">
      <FullScreen
        v-model="showDialog"
        title="原始收入数据详情"
        @returnBack="returnBack"
      >
        <div class="model-panel">
          <div class="model-panel-body">
            <div class="flex_full_item">
              <!-- 表格 -->
              <PageTable
                v-model:data="tableInfo.data"
                :pager="false"
                :checkBox="false"
                :tab-index="true"
                :isDynamic="true"
                :field-list="tableInfo.fieldList"
              >
              </PageTable>
            </div>
          </div>
        </div>
      </FullScreen>
    </div>
  </div>
</template>

<script setup name="assetEquipmentRevenueDetail">
import { getAssetAnalysisById } from '@/api/asset.js'
import { getAssetMonthIncomeCostQuery } from '@/api/dataQuery.js'

const { proxy } = getCurrentInstance()
const props = defineProps(['visible', 'id'])
// 表格相关
const tableInfo = ref({
  api: null,
  refresh: 1,
  initCurpage: 1,
  data: [],
  fieldList: [
    {
      label: '收入日期',
      value: 'netAmount',
    },
    {
      label: '项目编码',
      value: 'incomeRate',
    },
    {
      label: '项目名称',
      value: 'profitRate',
    },
    {
      label: '开单科室',
      value: 'positiveRate',
    },
    {
      label: '开单医生',
      value: 'useRate',
    },
    {
      label: '执行科室',
      value: 'investPayBackPeriod',
    },
    {
      label: '执行医生',
      value: 'investPayBackPeriod2',
    },
    {
      label: '检查(治疗)人次',
      value: 'investPayBackPeriod3',
    },
    {
      label: '阳性人次',
      value: 'investPayBackPeriod4',
    },
    {
      label: '收入费用',
      value: 'investPayBackPeriod5',
    },
    {
      label: '开机时长',
      value: 'investPayBackPeriod6',
    },
  ],
})
const showDialog = computed({
  get() {
    return props.visible
  },
  set(val) {
    proxy.$emit('update:visible', val) // 更新父组件visible
  },
})

onMounted(() => {
  if (props.id) {
    getList()
  }
})
function returnBack() {
  proxy.$emit('returnBack', false)
}
function getList() {
  getAssetMonthIncomeCostQuery().then((res) => {
    if (res && res.success) {
      if (res.data && res.data.list) {
        tableInfo.value.data = res.data.list
      } else {
        tableInfo.value.data = []
      }
    }
  })
}
</script>
<style scoped lang="scss">
:deep(.table-scroll-hidden) > .el-table {
  overflow-y: hidden;
}
:deep(.el-dialog__body) {
  height: 355px;
  display: flex;
  flex-direction: column;
}
</style>
